home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / Include / FWPresen.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  9.1 KB  |  283 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPresen.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPRESEN_H
  11. #define FWPRESEN_H
  12.  
  13. #ifndef FWTCOLL_H
  14. #include "FWTColl.h"
  15. #endif
  16.  
  17. #ifndef FWPART_H
  18. #include "FWPart.h"
  19. #endif
  20.  
  21. // ----- OS Layer -----
  22.  
  23. #ifndef FWRECT_H
  24. #include "FWRect.h"
  25. #endif
  26.  
  27. // ----- Foundation Includes -----
  28.  
  29. #ifndef FWRUNTYP_H
  30. #include "FWRunTyp.h"
  31. #endif
  32.  
  33. #ifndef FWTCOLL_H
  34. #include "FWTColl.h"
  35. #endif
  36.  
  37. // ----- OpenDoc -----
  38.  
  39. #ifndef FWODTYPS_H
  40. #include "FWODTyps.h"
  41. #endif
  42.  
  43. //========================================================================================
  44. //    Forward Declarations
  45. //========================================================================================
  46.  
  47. class ODArbitrator;
  48. class ODShape;
  49. class ODPart;
  50. class ODFrame;
  51. class ODFacet;
  52. class ODFocusSet;
  53.  
  54. class FW_CSelection;
  55. class FW_CFrame;
  56. class FW_MProxy;
  57. class FW_CViewAs;
  58.  
  59. //========================================================================================
  60. //    class FW_CPrivDisplayFrame
  61. //========================================================================================
  62.  
  63. class FW_CPrivDisplayFrame
  64. {
  65. public:
  66.     FW_CPrivDisplayFrame(Environment *ev, FW_CFrame* frame);
  67.     FW_CPrivDisplayFrame(Environment *ev, ODID frameID);
  68.     ~FW_CPrivDisplayFrame();
  69.     
  70.     void        Release(Environment *ev);
  71.     
  72.     ODID        fFrameID;
  73.     ODFrame*    fODFrame;
  74.     FW_CFrame*    fFrame;
  75. };
  76.  
  77. //========================================================================================
  78. //    class FW_CPresentation
  79. //========================================================================================
  80.  
  81. class FW_CPresentation
  82. {
  83. public:
  84.     friend class FW_CPresentationFrameIterator;
  85.     
  86. //----------------------------------------------------------------------------------------
  87. //    Constructors/Destructors
  88. //
  89. public:
  90.     FW_CPresentation(Environment *ev, 
  91.                     FW_CPart* thePart, 
  92.                     FW_CSelection* selection, 
  93.                     ODTypeToken presentationType,
  94.                     ODTypeToken defaultEmbeddedFrameViewType = FW_CPart::gViewAsFrameToken);
  95.     virtual ~FW_CPresentation();
  96.  
  97. //----------------------------------------------------------------------------------------
  98. //    New API
  99. //
  100. public:
  101.     // ----- Invalidate/Validate -----
  102.     void                Invalidate(Environment *ev, ODShape* invalidShape = NULL, ODID sequenceNumber = 0);
  103.     void                Validate(Environment *ev, ODShape* validShape = NULL, ODID sequenceNumber = 0);
  104.         
  105.     void                Invalidate(Environment* ev, const FW_CRect& invalidRect, ODID sequenceNumber = 0);
  106.     void                Validate(Environment* ev, const FW_CRect& validRect, ODID sequenceNumber = 0);
  107.  
  108.     // ----- Getters -----
  109.     FW_CSelection*        GetSelection(Environment* ev) const;
  110.     FW_CPart*            GetPart(Environment* ev) const;
  111.     ODTypeToken            GetPresentationType(Environment* ev) const;
  112.  
  113.     unsigned long        CountFrame(Environment* ev) const;
  114.     
  115.     void                SetDefaultEmbeddedFrameViewType(Environment *ev, ODTypeToken viewType);
  116.     ODTypeToken            GetDefaultEmbeddedFrameViewType(Environment *ev) const;
  117.  
  118.     // ------ Frame Negotiation -----
  119.     ODID                RequestSiblingFrame(Environment* ev,
  120.                                             FW_CFrame* baseFrame, 
  121.                                             ODShape* suggestedFrameShape,
  122.                                             ODTypeToken viewType,
  123.                                             FW_Boolean isOverlaid);
  124.     void                RemoveSiblingFrame(Environment* ev,
  125.                                             FW_CFrame* frameToRemove);                                
  126.     // ----- View In Window -----
  127.     ODID                OpenPartWindow(Environment* ev, FW_CFrame* sourceFrame, ODFacet* sourceFacet);
  128.     
  129.     FW_CFrame*            GetPartWindowFrame(Environment* ev) const;
  130.     FW_CWindow*            GetPartWindow(Environment* ev) const;
  131.     
  132.     // ----- View As -----
  133.     void                UpdateViewAs(Environment* ev);
  134.  
  135.     // ----- Change -----
  136.     void                ContentUpdated(Environment* ev, ODUpdateID updateID = kODUnknownUpdate);
  137.     
  138.     // ----- ReleaseAll -----
  139.     void                ReleaseAll(Environment* ev);
  140.     
  141.     // ----- Focus Set -----
  142.     ODFocusSet*            GetFocusSet(Environment* ev) const;
  143.     void                 SetFocusSet(Environment* ev, ODFocusSet* focusSet);    
  144.     void                AdoptFocusSet(Environment* ev, ODFocusSet* focusSet);
  145.  
  146.     // ----- Embedding -----
  147.     virtual void        Embed(Environment*    ev, 
  148.                                 ODPart*        embeddedPart,
  149.                                 ODFrame*     embeddedFrame,
  150.                                 ODType         frameType,
  151.                                 FW_MProxy*    proxy,
  152.                                 ODShape*    frameShape,
  153.                                 ODTypeToken viewType,
  154.                                 ODTypeToken    presentationType,
  155.                                 ODID        frameGroupID,
  156.                                 FW_Boolean    isOverlaid,
  157.                                 FW_Boolean    subFrame);
  158.     
  159.     
  160. //----------------------------------------------------------------------------------------
  161. //    Internal Use Only
  162. //
  163. public:
  164.     FW_CViewAs*            PrivAcquireViewAs(Environment* ev, FW_CFrame* frame, ODTypeToken viewAs);    
  165.     void                PrivReleaseViewAs(FW_CViewAs* viewAs);
  166.  
  167.     void                PrivAddFrame(Environment *ev, FW_CFrame* frame);
  168.     void                PrivDeleteDisplayFrame(Environment *ev, FW_CPrivDisplayFrame* displayFrame);
  169.     
  170.     void                PrivInvalidateIconedFrame(Environment *ev);
  171.  
  172.     FW_CPrivDisplayFrame*    PrivGetDisplayFrame(FW_CFrame* frame) const;
  173.     
  174.     virtual FW_CFrame*    PrivNewFrame(Environment *ev,
  175.                                     ODFrame* odFrame, 
  176.                                     FW_Boolean fromStorage);
  177.     
  178.     // ----- Frame Removed Notification -----
  179.     void                PrivFrameRemoved(Environment *ev, FW_CFrame* frame, FW_Boolean toStorage);
  180.  
  181.     // ----- A drag is pending on one of the frame of this presentation -----
  182.     FW_Boolean            PrivIsDragPending() const;
  183.     void                PrivSetDragPending(FW_Boolean pending);
  184.                                 
  185. //----------------------------------------------------------------------------------------
  186. //    Data Members
  187. //
  188. private:    
  189.     FW_CPart*                                        fPart;
  190.     FW_CSelection*                                    fSelection;
  191.     FW_TOrderedCollection<FW_CPrivDisplayFrame>*     fFrames;
  192.     ODTypeToken                                        fPresentationType;
  193.     ODFocusSet*                                        fFocusSet;
  194.     ODArbitrator*                                    fArbitrator;
  195.     
  196.     FW_CViewAs*                                        fViewAsThumbnail;
  197.     FW_CViewAs*                                        fViewAsSmallIcon;
  198.     FW_CViewAs*                                        fViewAsLargeIcon;
  199.     
  200.     FW_CFrame*                                        fPartWindowFrame;
  201.     
  202.     ODTypeToken                                        fDefaultEmbeddedFrameViewType;    // ViewAs of new embedded frames
  203.     FW_Boolean                                        fDragPending;                    // Use during a drag so the selecion can be flagged as in limbo
  204. };
  205.  
  206.  
  207. //========================================================================================
  208. // Inlines
  209. //========================================================================================
  210.  
  211. //----------------------------------------------------------------------------------------
  212. //    FW_CPresentation::GetSelection
  213. //----------------------------------------------------------------------------------------
  214. inline FW_CSelection* FW_CPresentation::GetSelection(Environment*) const
  215. {
  216.     return fSelection;
  217. }
  218.  
  219. //----------------------------------------------------------------------------------------
  220. //    FW_CPresentation::GetSelection
  221. //----------------------------------------------------------------------------------------
  222. inline FW_CPart* FW_CPresentation::GetPart(Environment*) const
  223. {
  224.     return fPart;
  225. }
  226.  
  227. //----------------------------------------------------------------------------------------
  228. //    FW_CPresentation::GetPresentationType
  229. //----------------------------------------------------------------------------------------
  230. inline ODTypeToken FW_CPresentation::GetPresentationType(Environment*) const
  231. {
  232.     return fPresentationType;
  233. }
  234.  
  235. //----------------------------------------------------------------------------------------
  236. //    FW_CPresentation::GetPartWindowFrame
  237. //----------------------------------------------------------------------------------------
  238. inline FW_CFrame* FW_CPresentation::GetPartWindowFrame(Environment*) const
  239. {
  240.     return fPartWindowFrame;
  241. }
  242.  
  243. //----------------------------------------------------------------------------------------
  244. //    FW_CPresentation::SetDefaultEmbeddedFrameViewType
  245. //----------------------------------------------------------------------------------------
  246. inline void FW_CPresentation::SetDefaultEmbeddedFrameViewType(Environment*, ODTypeToken viewType)
  247. {
  248.     fDefaultEmbeddedFrameViewType = viewType;
  249. }
  250.  
  251. //----------------------------------------------------------------------------------------
  252. //    FW_CPresentation::GetDefaultEmbeddedFrameViewType
  253. //----------------------------------------------------------------------------------------
  254. inline ODTypeToken FW_CPresentation::GetDefaultEmbeddedFrameViewType(Environment*) const
  255. {
  256.     return fDefaultEmbeddedFrameViewType;
  257. }
  258.  
  259. //----------------------------------------------------------------------------------------
  260. //    FW_CPresentation::GetFocusSet
  261. //----------------------------------------------------------------------------------------
  262. inline ODFocusSet* FW_CPresentation::GetFocusSet(Environment*) const
  263. {
  264.     return fFocusSet;
  265. }
  266.  
  267. //----------------------------------------------------------------------------------------
  268. //    FW_CPresentation::PrivIsDragPending
  269. //----------------------------------------------------------------------------------------
  270. inline FW_Boolean FW_CPresentation::PrivIsDragPending() const
  271. {
  272.     return fDragPending;
  273. }
  274.  
  275. //----------------------------------------------------------------------------------------
  276. //    FW_CPresentation::PrivSetDragPending
  277. //----------------------------------------------------------------------------------------
  278. inline void FW_CPresentation::PrivSetDragPending(FW_Boolean pending)
  279. {
  280.     fDragPending = pending;
  281. }
  282.  
  283. #endif